package com.cool.service.store.impl;
/**
 * 仓库的业务层实现类
 */

import com.cool.mapper.storemapper.StoreMapper;
import com.cool.po.storepo.StorePo;
import com.cool.service.store.StoreService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class StoreServiceImpl implements StoreService {
    //注入mapper对象
    @Autowired
    private StoreMapper storeMapper;
    //查询状态的方法
    @Override
    public List<Integer> getState() {
        List<Integer> list = storeMapper.getState();
        return list;
    }
    //模糊查询所有信息
    @Override
    public PageInfo<Map<String, Object>> getInfo(Map<String, Object> map) {
        PageHelper.startPage((int)map.get("pagenumber"),(int)map.get("pagesize"));
        List<Map<String, Object>> list = storeMapper.getInfo(map);
        PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
    //批量删除
    public void deleteAll(List<String> list){
        storeMapper.deleteAll(list);
    }
    //修改数据
    public void updateAll(Map<String, Object> map){
        storeMapper.updateByPrimaryKeySelective(map);
    }
}
